<extend name="add" />
<head>
<script src="__PUBLIC__/Admin/js/libs/jquery-1.8.3.js"></script>
</head>
<block name="title">
</block>
<block name="con">
	<div class="mws-panel grid_8">
		<div class="mws-panel-header">
			<span>管理员编辑</span>
		</div>
		<div class="mws-panel-body no-padding">
			<form class="mws-form" action="{:U('Admin/Admin/update')}" method="post" id="user">
				<div class="mws-form-inline">
					<div class="mws-form-row">
						<label class="mws-form-label">管理员ID</label>
						<div class="mws-form-item" style="padding-top: 6px;">
							{$info['id']}
						</div>
					</div>
					<div class="mws-form-row">
						<label class="mws-form-label">管理员名</label>
						<div class="mws-form-item">
							<input type="text" class="small" name="Username" value="{$info['Username']}">
						</div>
					</div>
					<div class="mws-form-row">
						<label class="mws-form-label">管理员密码</label>
						<div class="mws-form-item">
							<input type="password" class="small" name="Password" value="">
						</div>
					</div>
					<div class="mws-form-row">
						<label class="mws-form-label">确认密码</label>
						<div class="mws-form-item">
							<input type="password" onpaste="return false" oncopy="return false" class="small" name="ConfirmPassword">
							<span class="confirmpwd_error_tip"></span>
						</div>
					</div>
					<div class="mws-form-row">
						<label class="mws-form-label">管理员状态</label>
						<div class="mws-form-item">
							<select class="small" name="status">
								<option value="1" <eq name="info['status']" value="1">selected="selected"</eq>>正常</option>
								<option value="0" <eq name="info['status']" value="0">selected="selected"</eq>>禁用</option>
							</select>
						</div>
					</div>
				</div>
				<div class="mws-button-row">
					<input type="hidden" name="id" value="{$info['id']}">
					<input type="submit" value="修改" class="btn btn-danger">
					<input type="reset" value="重置" class="btn ">
					<input type="reset" class="btn btn-warning" value="返回" onclick="javascript:history.go(-1)">
				</div>
			</form>
		</div>
	</div>
</block>
<script type="text/javascript">
	$('input[name=Username]').blur(function(){
		var v = $(this).val();
		var m = $('.name_error_tip');
		if(v == ''){
			m.css('display','block').html('请输入用户名');
			nameOk = false;
		}
		else{
			var myReg = /^[a-zA-Z0-9_]{0,}$/;
			if (!myReg.test($(this).val())) {
				m.css('display','block').html('用户名不能包含中文和特殊字符');
				nameOk = false;
			}
			else {
				m.css('display','none');
				nameOk = true;
			}
		}
	})
	$('input[name=Password]').blur(function(){
		var v = $(this).val();
		var m = $('.pwd_error_tip');
		if(v == ''){
			m.css('display','block').html('请输入密码');
			pwdOk = false;
		}
		else{
			m.css('display','none');
			pwdOk = true;
		}
	})
	$('input[name=ConfirmPassword]').blur(function(){
		var v = $(this).val();
		var pw = $('input[name=Password]').val();
		var m = $('.confirmpwd_error_tip');
		if(v == ''){
			m.css('display','block').html('请输入确认密码');
			repwdOk = false;
		}
		else if(v != pw){
			m.css('display','block').html('确认密码必须和密码一致');
			repwdOk = false;
		}
		else{
			m.css('display','none');
			repwdOk = true;
		}
	})
	$('#user').submit(function(){
		$('input[name=Username]').trigger('blur');
		$('input[name=Password]').trigger('blur');
		$('input[name=ConfirmPassword]').trigger('blur');
		if(nameOk && pwdOk && repwdOk){
			return true;
		}
		else{
			return false;
		}
	})
</script>
